import upyun


class Myupy:
    def __init__(self):
        #                           服务名称               账号                         密码
        self.up = upyun.UpYun("caobaofuupyun", "cbf13013286056", "cMIUDw1dTLCtxde4Bfj66qsr0MDjGPfc")

    # 上传文件
    def upload(self, upload_dir, file, userid):
        with open(upload_dir , 'rb') as f:
            self.up.put('/' + str(userid) + '/' + file, f)


myup = Myupy()
myup.upload('D:/project/p6/p6_education/static/upload/1/e80e6ff9f99c42cfa687368c26a433bb.jpg',
            'e80e6ff9f99c42cfa687368c26a433bb.jpg', 3)
